// @ts-ignore
/* eslint-disable */
import { request } from 'umi';

/** 设备联动任务详情页 GET /api/device/linkage/${param0} */
export async function getDeviceLinkageInfo(
  params: {
    // path
    /** 任务id */
    id: string;
  },
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<API.DeviceLinkageItem>(`/api/device/linkage/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 设备联动任务 GET /api/device/linkage */
export async function queryDeviceLinkage(
  params: {
    // query
    /** 当前的页码 */
    current?: number;
    /** 页面的容量 */
    pageSize?: number;
  },
  options?: { [key: string]: any },
) {
  return request<API.RequestData>('/api/device/linkage', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 更新设备联动任务 PUT /api/device/linkage */
export async function updateDeviceLinkage(
  body: API.DeviceLinkageItem,
  options?: { [key: string]: any },
) {
  return request<Record<string, any>>('/api/device/linkage', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 添加设备联动任务 POST /api/device/linkage */
export async function addDeviceLinkage(
  body: API.DeviceLinkageItem,
  options?: { [key: string]: any },
) {
  return request<Record<string, any>>('/api/device/linkage', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 删除设备联动任务 DELETE /api/device/linkage */
export async function removeDeviceLinkage(options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/device/linkage', {
    method: 'DELETE',
    params: {
      ...options,
    },
    ...(options || {}),
  });
}

/** 删除设备联动任务 */
export async function batchRemoveDeviceLinkage(options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/device/linkage/batchdel', {
    method: 'DELETE',
    params: {
      ...options,
    },
    ...(options || {}),
  });
}
